
function request(url,data){
    return new Promise((resolve,reject)=>{
        $.ajax({
            type:'get',
            url,
            data,
            dataType:'json',
            success:function(result){
                var {
                    code,
                    msg,
                    data
                }=result

                if(data){//注册成功
                    // alert(data.msg)
                    resolve(data)
                    
                }else{
                    // alert(data.msg)
                    // location.href="denglu.html"
                    reject(msg)
                   
                }
    
            }
        })
    
    })
}

// const userRegister=params=>request("http://localhost:8081/1907/19071/zhuce.php",params)

//
function userRegister(params){
    return request("http://localhost:8081/1907/19071/zhuce.php",params)
}

function userLogin(params){
    return request("http://localhost:8081/1907/19071/denglu.php",params)
}

function userDelect(params){
    return request("http://localhost:8081/1907/19071/list-shanchu.php",params)
}

function userList(params){
    return request("http://localhost:8081/1907/19071/liebiao.php",params)
}

function userUpdate1(params){
    return request("http://localhost:8081/1907/19071/list-xiugai.php",params)
}

function userUpdate2(params){
    return request("http://localhost:8081/1907/19071/list-update.php",params)
}

export{
    userRegister,
    userLogin,
    userDelect,
    userList,
    userUpdate1,
    userUpdate2

}